/*
 * Copyright 2008 Max Kugland
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.splink.library.reflection {

	/**
	 * @author Max Kugland
	 */
	public interface IMember {
		/**
		 * @return the name of the <code>IMember</code>
		 */
		function get name() : String;

		/**
		 * @return whether the <code>IMember</code> is static or not
		 */
		function get isStatic() : Boolean;

		/**
		 * @return the return type of the <code>IMember</code>
		 */
		function get returntype() : String;

		/**
		 * @return the class to which the <code>IMember</code> belongs
		 */
		function get clazz() : Class;

		/**
		 * Invokes the <code>IMember</code> on a given instance, or if the <code>IMember</code> is
		 * static invokes the <code>IMember</code> on its corresponding class.
		 * 
		 * @param instance the instance to invoke the <code>IMember</code> on
		 * @param params (optional) an Object which is assigned to the <code>IMember</code>, if the
		 * <code>IMember</code> is of type <code>Accessor</code> this is only applied if the 
		 * <code>Accessor</code> has is settable.
		 * @return the return value of the invoked method
		 */
		function invoke(instance : Object = null, params : * = null) : *

		/**
		 * @return an array of <code>MetaData</code> objects representing the <code>IMember</code> 
		 * metadata if it is present, otherwise returns an empty array
		 */
		function get metaData() : Array;
	}
}
